from vnc import VNC
import logging

# 设置日志级别以便看到详细信息
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')

if __name__ == "__main__":
    vnc_with_password = VNC("192.168.0.104", "5900", password="000000")
    vnc_success = vnc_with_password.connect()

    if vnc_success:
        print("密码连接成功！")
        # vnc截图保存到本地 (保色清晰化)
        print("开始保色清晰化截图...")
        success = vnc_with_password.capture_screen_debug("./dnf.png")
        if success:
            print("保色清晰化截图保存成功：./dnf.png")
        else:
            print("截图保存失败")
        vnc_with_password.close()
    else:
        print("密码连接也失败了，请检查VNC服务器配置")